using System;
using System.Collections;
using System.Text;
using System.Configuration;
using System.Xml;


namespace Services.WCF.Hosting
{
    [ConfigurationCollection(typeof(ServiceConfigurationElement), AddItemName = "service")]
    public class ServiceConfigurationElementCollection : ConfigurationElementCollection
    {

        public ServiceConfigurationElementCollection()
        {
        }

        protected override ConfigurationElement CreateNewElement()
        {
            return new ServiceConfigurationElement();
        }

        protected override object GetElementKey(ConfigurationElement element)
        {
            return ((ServiceConfigurationElement)element).Name;
        }

        public void Add(ServiceConfigurationElement element)
        {
            this.BaseAdd(element);
        }

        public void Remove(string key)
        {
            this.BaseRemove(key);
        }

        public void Clear()
        {
            this.BaseClear();
        }

        public new ServiceConfigurationElement this[String name]
        {
            get
            {
                ServiceConfigurationElement element = (ServiceConfigurationElement)base.BaseGet(name);
                if (element == null)
                    return new ServiceConfigurationElement();
                else
                    return (ServiceConfigurationElement)base.BaseGet(name);
            }
        }
    }
    
}
